package com.share.example.stock.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.share.example.stock.model.db.StockDayPrice;
import com.share.example.stock.model.vo.DayCodePrice;
import com.share.example.stock.model.vo.DayMinMaxAvgSamp;
import com.share.example.stock.model.vo.DayPriceVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper接口
 * </p>
 *
 * @author author
 * @since 2023-06-10
 */
public interface StockDayPriceMapper extends BaseMapper<StockDayPrice> {

    int insertbatch(@Param("list") List<StockDayPrice> list);

    int deleteByDate(@Param("date") String date);

    int deleteRepeat();

    int deleteRepeatByCode(@Param("code") String code);

    List<String> listCodeByDay(@Param("date") String date);

    int updateByCodeAndDate(@Param("record") StockDayPrice record);

    List<DayPriceVo> groupCodeByDate(String startDate, String endDate);

    //这里的警告不要管,idea有问题无法识别
    @MapKey("code")
    Map<String, DayCodePrice> mapLastRecordNotContainEnd(@Param("endDate") String endDate);

    //这里的警告不要管,idea有问题无法识别
    @MapKey("code")
    Map<String, DayMinMaxAvgSamp> calcPriceByDateNotContainStartAndEnd(@Param("startDate") String startDate, @Param("endDate") String endDate);
}
